package com.example.skycode6.dao;

import util.DBConnection;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class AdminDao {
    DBConnection DBConn = new DBConnection();


    public boolean Checklogin(String s1,String s2)
        throws SQLException {
        // conn对象代表数量路连接
        Connection conn = DBConn.getConn();
        Statement stmt = conn.createStatement();
        ResultSet rs = null;
        boolean ok = true;
        String sql = "select * from admin where " +
                " AdminName = '"   + s1 +"' and " +
                " adminpwd = '" +s2 +"'";
        rs =stmt.executeQuery(sql);
        if(!rs.next()){
            ok = false;
        }
        return ok;
    }
}
